<template>
	<view>
	<u-navbar title="设置" backIconColor="#fff" titleColor="#fff" :background="background"></u-navbar>
	<view class="">
		<u-cell-group>
				<u-cell-item title="头像" valueByImg="http://img.wxcha.com/file/201902/25/c4c6d56dc2.jpg"></u-cell-item>
				<u-cell-item title="昵称" value="Ipic"></u-cell-item>
				<u-cell-item title="性别" value="男"></u-cell-item>
				<u-cell-item title="生日" value="2021-07-01"></u-cell-item>
				<u-cell-item title="格言" value="剑未佩妥,出门已是江湖"></u-cell-item>
		</u-cell-group>
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item title="手机号" value="(未绑定)"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item title="网络设置" :value="domain" @click="network_setting"></u-cell-item>
				<u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
				
			</u-cell-group>
			<u-cell-group>
				<u-cell-item  title="保存到相册" :arrow="false">
					<u-switch v-model="model.savePhotoToAlbum" slot="right-icon" @change="changeSavePhotoToAlbum"></u-switch>
				</u-cell-item>
				<u-cell-item  title="拍照自动上传" :arrow="false">
					<u-switch v-model="model.photoAutoUpload" slot="right-icon" @change="changePhotoAutoUpload"></u-switch>
				</u-cell-item>
			</u-cell-group>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				labelPosition: 'left',
				errorType: ['message'],
				domain:"",
				show: false,
				background:this.TopColor,
				list:[
					{
						label: '本地调试',
						value: 'http://192.168.31.218:6002'
					},
					{
						label: '公司网络',
						value: 'http://192.168.31.48:5800'
					},
					{
						label: '线上运营',
						value: 'http://jin.routeyo.net:5800'
					}
				],
				model: {
					savePhotoToAlbum: this.$db.get("savePhotoToAlbum") == "" ? false :this.$db.get("savePhotoToAlbum"),
					photoAutoUpload: this.$db.get("photoAutoUpload") == "" ? false :this.$db.get("photoAutoUpload"),
				},
			}
		},
		onLoad() {
			this.domain = this.$db.get("domain").value;
		},
		methods:{
			changePhotoAutoUpload(e){
				this.model.photoAutoUpload = e;
				this.$db.set("photoAutoUpload",e);
			},
			changeSavePhotoToAlbum(e){
				this.model.savePhotoToAlbum = e;
				this.$db.set("savePhotoToAlbum",e);
			},
			network_setting(){
				// this.$common.navigateTo("/mine/setting_network")
				this.show = true;
			},
			confirm(e) {
				console.log("当前选择网络:",e[0].label,e[0].value);
				this.$db.set("domain",e[0]);
				this.domain = this.$db.get("domain").value;
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #ededed;
	}
</style>
